package main.java.leetcode.简单;

import org.junit.Test;

public class leetcode_557_反转字符串中的单词 {

    @Test
    public void test(){
        String target = "abs in my application";
        System.out.println(reverseWords(target));
    }



    public String reverseWords(String s){
        String[] split = s.split(" ");
        StringBuilder stringBuilder = new StringBuilder(s.length());
        String s1 = new String();
        for (int i = 0;i< split.length;i++){
            for (int j = split[i].length()-1;j>=0;j--){
                s1 += split[i].charAt(j);
            }
            stringBuilder.append(s1+" ");
            s1 = "";
        }
        return stringBuilder.toString().trim();
    }
}
